#ifndef _MARKER_
#define _MARKER_

#include "BodyLink.h"
#include "PrimitiveEllipsoid.h"

class Dof;
class BodyLink;

class Marker{
public:
	enum ConstraintType {NO, HARD, SOFT};
protected:
	BodyLink *mBody;	// body link associated with
	Vec3d mCoords;	// local coordinates in the links
	Primitive *mEllipsoid;
	char mName[128];
	int mModelID;	// position in the model class handle vector
	ConstraintType mConstrained;

public:
	Marker(char* _name, Vec3d _coords, BodyLink *_body, ConstraintType _type = NO){ 
		mEllipsoid = new PrimitiveEllipsoid(vl_0, Vec3d(0.05,0.05,0.05), 0);
		mBody = _body;
		strcpy(mName, _name);
		mCoords = _coords;
		mConstrained = _type;
	}	
	~Marker(){}

	void draw(bool _noOffsetting=false, Vec4d _color=Vec4d(vl_1), bool _default=true);
	Vec3d getWorldCoords();
	Vec3d getPartialDeriv(Dof *d);	// get partial wrt d
	
	inline Vec3d getLocalCoords(){ return mCoords; }
	inline void setLocalCoords( Vec3d _coords ){ mCoords = _coords; }
	inline void setModelID(int _m){mModelID=_m;}
	inline int getModelID(){return mModelID;}
	inline int getID(){return mEllipsoid->getID();}
	inline BodyLink* getBody(){return mBody;}
	inline char* getName() { return mName; }
	// useful for IK
	inline ConstraintType getConstraintType(){return mConstrained;}
	inline void setConstraintType(ConstraintType _type){mConstrained=_type;}
};

#endif
